<template>
  <el-form :model="Form" ref="Form" :label-width="label ? '5.625rem' : '0'"
    :class="'table_form' + (label ? '' : ' noLabel')" :inline="true">
    <!-- <el-form-item  label="客户公司编号：" prop="clientCompanyId" key="clientCompanyId"
      class="select-form">
      <el-input v-model="Form.clientCompanyId" size="medium"  placeholder="请输入公司编号" clearable></el-input>
    </el-form-item> -->

    <el-form-item label="公司名称：" prop="supplierCompanyName" key="supplierCompanyName" class="select-form">
      <el-input v-model="Form.supplierCompanyName" size="medium" placeholder="请输入公司名称" clearable></el-input>
    </el-form-item>


    <el-form-item class="btn">
      <el-button size="mini" type="primary" icon="el-icon-search" @click="Search" class="square" circle></el-button>
      <el-button size="mini" type="info" @click="Reset" class="square" plain circle>重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import {
  mapState
} from 'vuex'

export default {
  props: ['label', 'queryInfo'],
  data() {
    return {
      // 表格的表单
      Form: {
        supplierCompanyName: '',
        // clientCompanyId: ''

      }
    }
  },
  computed: {
    ...mapState([

    ]),
    queryInfo_: {
      get() {
        return this.queryInfo
      },
      set(val) {
        this.$emit('update:queryInfo', val)
      }
    }
  },
  methods: {
    querySearch(queryString, cb) {
      var restaurants = this.User_firstName_List;

      var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    createFilter(queryString) {
      return (restaurant) => {
        return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
      };
    },
    // 搜索
    Search() {
      var timeJson = {},
        multipleJson = {},
        likeNameJson = {}


      this.$MultipleToJsonKeyLine(this.Form.supplierCompanyName, likeNameJson, 'supplierCompanyName') // 微信号
      this.queryInfo_.likeNameSearch = JSON.stringify(likeNameJson) // 模糊查询


      this.$emit('CurrentChange', 1)
    },
    // 重置
    Reset() {
      this.resetFields()
      this.Search()
    },
    // 重置表单
    resetFields() {
      this.$refs['Form'].resetFields()
    }
  }
}
</script>

<style lang="scss" scoped>
@import "@/assets/css/profession/profession/child-form.scss";
</style>
